package audio;

import mllib.*;
import java.util.Scanner;
import java.io.*;

public class AudioClassifierTester
{
    public static void main(String[] args)
    {
        Classifier c = null;
        Scanner sc = null;

        try{

          if( args.length < 2)
          {
              System.out.println("Args: TrainingFile TestFile");
              System.exit(1);
          }
          else if(args.length == 2)
          {
            c = new Classifier( args[0], Classifier.NoReducer, Classifier.GEstimator,  2000);
            sc = new Scanner(new File(args[1]));
          }
          else
          {
            c = new Classifier( args[0], args[2], Classifier.NoReducer, Classifier.GEstimator,   2000);
            sc = new Scanner(new File(args[1]));
          }

          int dim = sc.nextInt();
          sc.nextLine();
          while(sc.hasNextLine() )
          {
              String realWord = sc.next();
              double[] v = new double[dim];
              for( int i = 0; i < dim; i++) {
                  v[i] = sc.nextDouble();
              }
              sc.nextLine();
              System.out.println("\t\t\t\t\t\t\tClassified " +realWord+ " as " + c.identify( v));
          }

        }catch(Exception e){
            e.printStackTrace();
         }
    }

}
